package com.baizhi.interceptor;



import com.baizhi.entity.DdUser;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @author admin
 */
public class AccountInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        System.out.println("执行过滤器");
        HttpSession session = request.getSession();
        DdUser user = (DdUser) session.getAttribute("user");
        if (user==null){
            return false;
        }else {
            return true;
        }
    }
}
